Merged
Conversation
This commit fixes a longstanding issue in wasi-libc where the `linkat` function, when both parameters are `AT_FDCWD` or absolute paths, would relativize the two input paths in such a way that the previous stomped over the first, meaning that the wrong actual syscall was issued. This fixes the problem in the same manner as other two-path-taking functions which is to use `find_relpath` for one path and `find_relpath_alt` for the other path.
This was referenced Dec 10, 2025
yamt
approved these changes
Dec 12, 2025
| char dst[] = "/dir/b"; | ||
|
|
||
| TEST(mkdir("dir", 0700) == 0); | ||
| TEST((fd = open(src, flags | O_WRONLY | O_CREAT | O_EXCL, 0600)) > 2); |
Collaborator
Author
There was a problem hiding this comment.
I'm hoping to work on clang-format after #685 is merged but for now it's a bit messy all the style in the repo, this is I believe not the first test with this for example.
abrown
approved these changes
Dec 12, 2025
Collaborator
abrown
left a comment
There was a problem hiding this comment.
LGTM! And thanks for the extra tests.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Dec 14, 2025
…joboet std: Don't use `linkat` on the `wasm32-wasi*` targets This commit is a follow-up to rust-lang#147572 and the issue reported at the end of that PR where the `std::fs::hard_link` function is broken after that PR landed. The true culprit and bug here is fixed in WebAssembly/wasi-libc#690 but until that's released in a wasi-sdk version it should be reasonable, on WASI, to skip the `linkat` function.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Dec 14, 2025
…joboet std: Don't use `linkat` on the `wasm32-wasi*` targets This commit is a follow-up to rust-lang#147572 and the issue reported at the end of that PR where the `std::fs::hard_link` function is broken after that PR landed. The true culprit and bug here is fixed in WebAssembly/wasi-libc#690 but until that's released in a wasi-sdk version it should be reasonable, on WASI, to skip the `linkat` function.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Dec 14, 2025
…joboet std: Don't use `linkat` on the `wasm32-wasi*` targets This commit is a follow-up to rust-lang#147572 and the issue reported at the end of that PR where the `std::fs::hard_link` function is broken after that PR landed. The true culprit and bug here is fixed in WebAssembly/wasi-libc#690 but until that's released in a wasi-sdk version it should be reasonable, on WASI, to skip the `linkat` function.
rust-timer
added a commit
to rust-lang/rust
that referenced
this pull request
Dec 15, 2025
Rollup merge of #149864 - alexcrichton:wasi-avoid-linkat, r=joboet std: Don't use `linkat` on the `wasm32-wasi*` targets This commit is a follow-up to #147572 and the issue reported at the end of that PR where the `std::fs::hard_link` function is broken after that PR landed. The true culprit and bug here is fixed in WebAssembly/wasi-libc#690 but until that's released in a wasi-sdk version it should be reasonable, on WASI, to skip the `linkat` function.
github-actions bot
pushed a commit
to rust-lang/miri
that referenced
this pull request
Dec 18, 2025
std: Don't use `linkat` on the `wasm32-wasi*` targets This commit is a follow-up to rust-lang/rust#147572 and the issue reported at the end of that PR where the `std::fs::hard_link` function is broken after that PR landed. The true culprit and bug here is fixed in WebAssembly/wasi-libc#690 but until that's released in a wasi-sdk version it should be reasonable, on WASI, to skip the `linkat` function.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit fixes a longstanding issue in wasi-libc where the
linkatfunction, when both parameters areAT_FDCWDor absolute paths, would relativize the two input paths in such a way that the previous stomped over the first, meaning that the wrong actual syscall was issued. This fixes the problem in the same manner as other two-path-taking functions which is to usefind_relpathfor one path andfind_relpath_altfor the other path.